import {request} from "@umijs/max";

export async function getGroups(params: GROUP.GetGroupsParams, options?: { [key: string]: any }) {
  // 将 params 对象转换为查询字符串
  const queryString = new URLSearchParams(params as any).toString();

  return request<{
    data: GROUP.GetGroupsResult
  }>(`/wxgroup/searchGroup?${queryString}`, {
    method: 'GET',
    ...(options || {}),
  });
}

export async function setGroupPower(params: GROUP.SetGroupPowerParams, options?: { [key: string]: any }) {
  return request<{
    data: API.ApiResult
  }>(`/wxgroup/setGroupPermission`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: params,
    // data: {
    //   ...params
    // },
    ...(options || {}),
  });
}
